<?php
require_once('../bbs/source/class/class_core.php');

$discuz = & discuz_core::instance();

$discuz -> init_cron = false;

$discuz -> init_session = false;

$discuz -> init();

require_once('resources/class/JAdmin_core.php');

JAdmin_core::init();

//Jfun类库
require_once('resources/class/jFn/jFn.php');

Jpublic::$int_str = array('id', 'page', 'top', 'group');

//连接数据
Jdb::con(DATABASE_TABLE, DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);

$PAGING = new Jpaging;

$DATE   = new Jdate;

$FILE   = new Jfile;

$UPLOAD = new Jupload;

$CACHE  = new Jcache;

$CACHE -> init(array(

	'timeout' => 12,
	
	'root' => 'index/cache/',
	
));

//网站私有类
require_once('resources/class/private/common.php');

//获取网站默认数据
$WEBOSDATA = common::webos_data();

//获取网站基本数据
$WEBOSBASIC = common::webos_basic();

//加载语言包
require_once('resources/lang-php/cn/lang-arr.php');

//HTML类
require_once('resources/class/JAdmin_HTML_PHP.php');

$HTML = new JAdmin_HTML;

//用户数据
$USER = JAdmin_core::member();

Jpublic::get('mod') != '' && $mod = Jpublic::get('mod');

Jpublic::get('action') != '' && $action = Jpublic::get('action');

//加载组权限
require_once('resources/group/webos.php');

require_once('resources/group/public.php');

if (JAdmin_core::check_login()) {
	
	$group_file = explode(',', $USER['webos_group_file']);
	
	foreach ($group_file as $key => $value) {
	
		require_once('resources/group/' . $value . '.php');
		
	}
	
}

$windowID = Jpublic::get('webosWindowID');

switch ($action) {
	
	case 'public':
		
		if (in_array($mod, $group_file_public)) {
			
			require_once('resources/model/public/' . $mod . '.php');
			
		} else {
			
			require_once('resources/error/404.php');
			
		}
	
	break;
	
	case 'webos':
		
		if (in_array($mod, $group_file_webos)) {
			
			require_once('resources/model/webos/' . $mod . '.php');
			
		} else {
			
			require_once('resources/error/404.php');
			
		}
		
	break;
	
	case 'admin':
		
		if (in_array($mod, $group_file_admin)) {
			
			require_once('resources/model/admin/' . $mod . '.php');
			
		} else {
			
			require_once('resources/error/404.php');
			
		}
	
	break;
	
	case 'member':
		
		if (!in_array($mod, $group_file_member)) {
			
			if ($type == 'ajax') {
				
				require_once('resources/error/ajax.php');
				
			} else {
				
				require_once('resources/error/404.php');
				
			}
			
		} else {
			
			require_once('resources/model/member/' . $mod . '.php');
			
		}
		
	break;
	
	default:
	
		require_once('resources/error/404.php');
	
	break;
}
?>